home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / entrypt.h.z / entrypt.h
C/C++ Source or Header  |  1992-04-03  |  10KB  |  267 lines

  1. #ifndef __SYS_ENTRYPT_H__
  2. #define __SYS_ENTRYPT_H__
  3.  
  4. /**************************************************************************
  5.  *                                      *
  6.  *          Copyright (C) 1988, Silicon Graphics, Inc.          *
  7.  *                                      *
  8.  *  These coded instructions, statements, and computer programs  contain  *
  9.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  10.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  11.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  12.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  13.  *                                      *
  14.  **************************************************************************/
  15.  
  16. /*
  17.  * Copyright 1985 by MIPS Computer Systems, Inc.
  18.  */
  19.  
  20. #ident "$Revision: 1.24 $"
  21.  
  22. /*
  23.  * entrypt.h -- misc. defines of interest to standalones and kernels
  24.  */
  25.  
  26. /*
  27.  * Prom entry points
  28.  */
  29.  
  30. /*
  31.  * Return control to prom entry points
  32.  *
  33.  * RESET    transferred to on hardware reset, configures MIPS boards,
  34.  *        runs diags, check for appropriate auto boot action in
  35.  *        "bootmode" environment variable and performs that action.
  36.  *
  37.  * EXEC        called to utilize prom to boot new image.  After the booted
  38.  *        program returns control can either be returned to the
  39.  *        original caller of the exec routine or to the prom monitor.
  40.  *        (to return to the original caller, the new program must
  41.  *        not destroy any text, data, or stack of the parent.  the
  42.  *        new programs stack continues on the parents stack.
  43.  *
  44.  * RESTART    re-enter the prom command parser, do not reset prom state
  45.  *
  46.  * REINIT    reinitialize prom state and re-enter the prom command parser
  47.  *
  48.  * REBOOT    check for appropriate bootmode and perform, no configuration
  49.  *        or diags run
  50.  *
  51.  * AUTOBOOT    perform an autoboot sequence, no configuration or diags run
  52.  *
  53.  */
  54. #if IP5 && STANDALONE
  55. #define    PROM_ENTRY(x)    (MONITOR_TEXT+((x)*8))
  56. #else
  57. #define    PROM_ENTRY(x)    (R_VEC+((x)*8))
  58. #endif
  59.  
  60. #define    PROM_RESET    PROM_ENTRY(0)    /* run diags, check bootmode, reinit */
  61. #define    PROM_EXEC    PROM_ENTRY(1)    /* load new program image */
  62. #define    PROM_RESTART    PROM_ENTRY(2)    /* re-enter monitor command loop */
  63. #define    PROM_REINIT    PROM_ENTRY(3)    /* re-init monitor, then cmd loop */
  64. #define    PROM_REBOOT    PROM_ENTRY(4)    /* check bootmode, no config */
  65. #define    PROM_AUTOBOOT    PROM_ENTRY(5)    /* autoboot the system */
  66. /*
  67.  * these routines access prom "saio" routines, and may be used
  68.  * by standalone programs that would like to use prom io
  69.  */
  70. #define    PROM_OPEN    PROM_ENTRY(6)
  71. #define    PROM_READ    PROM_ENTRY(7)
  72. #define    PROM_WRITE    PROM_ENTRY(8)
  73. #define    PROM_IOCTL    PROM_ENTRY(9)
  74. #define    PROM_CLOSE    PROM_ENTRY(10)
  75. #define    PROM_GETCHAR    PROM_ENTRY(11)    /* getchar from console */
  76. #define    PROM_PUTCHAR    PROM_ENTRY(12)    /* putchar to console */
  77. #define    PROM_SHOWCHAR    PROM_ENTRY(13)    /* show a char visibly */
  78. #define    PROM_GETS    PROM_ENTRY(14)    /* gets with editing */
  79. #define    PROM_PUTS    PROM_ENTRY(15)    /* puts to console */
  80. #define    PROM_PRINTF    PROM_ENTRY(16)    /* kernel style printf to console */
  81. /*
  82.  * prom protocol entry points
  83.  */
  84. #define    PROM_INITPROTO    PROM_ENTRY(17)    /* initialize protocol */
  85. #define    PROM_PROTOENABLE PROM_ENTRY(18)    /* enable protocol mode */
  86. #define    PROM_PROTODISABLE PROM_ENTRY(19)/* disable protocol mode */
  87. #define    PROM_GETPKT    PROM_ENTRY(20)    /* get protocol packet */
  88. #define    PROM_PUTPKT    PROM_ENTRY(21)    /* put protocol packet */
  89.  
  90. #if R2300
  91. /*
  92.  * VME RMW routines
  93.  * Other CPUs do these in the kernel, but R2300 takes special care
  94.  */
  95. #define    PROM_ORW_RMW    PROM_ENTRY(22)    /* OR-word RMW */
  96. #define    PROM_ORH_RMW    PROM_ENTRY(23)    /* OR-half RMW */
  97. #define    PROM_ORB_RMW    PROM_ENTRY(24)    /* OR-byte RMW */
  98. #define    PROM_ANDW_RMW    PROM_ENTRY(25)    /* AND-word RMW */
  99. #define    PROM_ANDH_RMW    PROM_ENTRY(26)    /* AND-half RMW */
  100. #define    PROM_ANDB_RMW    PROM_ENTRY(27)    /* AND-byte RMW */
  101. #endif /* R2300 */
  102.  
  103. /*
  104.  * cache control entry points
  105.  * flushcache is called without arguments and invalidates entire contents
  106.  *    of both i and d caches
  107.  * clearcache is called with a base address and length (where address is
  108.  *     either K0, K1, or physical) and clears both i and d cache for entries
  109.  *     that alias to specified address range.
  110.  */
  111. #define    PROM_FLUSHCACHE    PROM_ENTRY(28)    /* flush entire cache */
  112. #define    PROM_CLEARCACHE    PROM_ENTRY(29)    /* clear_cache(addr, len) */
  113. /*
  114.  * The following entry points are sole to reduce the size of the debug
  115.  * monitor and could be removed by including the appropriate code in the
  116.  * debugger
  117.  *
  118.  * Libc-ish entry points
  119.  */
  120. #define    PROM_SETJMP    PROM_ENTRY(30)    /* save stack state */
  121. #define    PROM_LONGJMP    PROM_ENTRY(31)    /* restore stack state */
  122. #define    PROM_BEVUTLB    PROM_ENTRY(32)    /* utlbmiss boot exception vector */
  123. #define    PROM_GETENV    PROM_ENTRY(33)    /* get environment variable */
  124. #define    PROM_SETENV    PROM_ENTRY(34)    /* set environment variable */
  125. #define    PROM_ATOB    PROM_ENTRY(35)    /* convert ascii to binary */
  126. #define    PROM_STRCMP    PROM_ENTRY(36)    /* string compare */
  127. #define    PROM_STRLEN    PROM_ENTRY(37)    /* string length */
  128. #define    PROM_STRCPY    PROM_ENTRY(38)    /* string copy */
  129. #define    PROM_STRCAT    PROM_ENTRY(39)    /* string concat */
  130. /*
  131.  * command parser entry points
  132.  */
  133. #define    PROM_PARSER    PROM_ENTRY(40)    /* command parser */
  134. #define    PROM_RANGE    PROM_ENTRY(41)    /* range parser */
  135. #define    PROM_ARGVIZE    PROM_ENTRY(42)    /* tokenizer */
  136. #define    PROM_HELP    PROM_ENTRY(43)    /* prints help from command table */
  137. /*
  138.  * prom commands
  139.  */
  140. #define    PROM_DUMPCMD    PROM_ENTRY(44)    /* dump memory command */
  141. #define    PROM_SETENVCMD    PROM_ENTRY(45)    /* setenv command */
  142. #define    PROM_UNSETENVCMD PROM_ENTRY(46)    /* unsetenv command */
  143. #define    PROM_PRINTENVCMD PROM_ENTRY(47)    /* printenv command */
  144. #define    PROM_BEVEXCEPT    PROM_ENTRY(48)    /* general boot exception vector */
  145. #define    PROM_ENABLECMD    PROM_ENTRY(49)    /* enable console command */
  146. #define    PROM_DISABLECMD    PROM_ENTRY(50)    /* disable console command */
  147.  
  148. /*
  149.  * clear existing fault handlers
  150.  * used by clients that link to prom on situations where client has
  151.  * interrupted out of prom code and wish to reenter without being
  152.  * tripped up by any pending prom timers set earlier.
  153.  */
  154. #define    PROM_CLEARNOFAULT PROM_ENTRY(51)/* clear existing fault handlers */
  155.  
  156. /*
  157.  * PROM_NOTIMPLEMENT is guaranteed to be not implemented so programs
  158.  * which link against various rev's of the prom can config to entry points
  159.  * which aren't implemented in earlier prom rev's.  An entry point is
  160.  * guaranteed to be implemented if the 32 bit word at the prom entrypt
  161.  * is not equal to this entrypt.
  162.  */
  163. #define    PROM_NOTIMPLEMENT PROM_ENTRY(52)/* guaranteed to be not implemented */
  164. #define PROM_EADDR    PROM_ENTRY(53)    /* IP6 get phys ethernet addr */
  165. #define PROM_DEXEC    PROM_ENTRY(55)    /* IP6 destructive prom exec */
  166. #define    PROM_SETNVRAM    PROM_ENTRY(57)    /* IP6 set nvram env variables */
  167.  
  168. /*
  169.  * PROM_NVRAM_TAB is used to copy the PROM's nvram table into the
  170.  * kernel so that the kernel can find the current offsets into
  171.  * nvram for the boot variables stored there.
  172.  */
  173. #define    PROM_NVRAM_TAB    PROM_ENTRY(58)    /* IP12 get nvram table */
  174.  
  175. /*
  176.  * Restart block -- miscellaneous variables saved across prom/sash/kernel
  177.  *                  transitions.
  178.  *
  179.  */
  180. #define    RESTART_MAGIC    0xfeedface
  181. #define    RESTART_CSUMCNT    32        /* chksum 32 words of restart routine */
  182. #define    RB_BPADDR    (RESTART_ADDR+24)/* address of rb_bpaddr */
  183. #define RB_MGADDR    RESTART_ADDR    /* address of rb_magic */
  184.  
  185. #ifdef LANGUAGE_C
  186.  
  187. /*
  188.  * args to promexec -- monitor support for loading new programs
  189.  *
  190.  * bootfiles should be specified as DEV(UNIT)FILE
  191.  * (e.g. dksc(0,1,8)ide)
  192.  */
  193. struct promexec_args {
  194.     char    *pa_bootfile;        /* file to boot (only some devices) */
  195.     int    pa_argc;        /* arg count */
  196.     char    **pa_argv;        /* arg vector */
  197.     char    **pa_environ;        /* environment vector */
  198.     int    pa_flags;        /* flags, (see below) */
  199. };
  200. /*
  201.  * promexec flags
  202.  */
  203. #define    EXEC_NOGO    1    /* just load, don't transfer control */
  204.  
  205. struct restart_blk {
  206.     int    rb_magic;        /* magic pattern */
  207.     int    (*rb_restart)();    /* restart routine */
  208.     int    rb_occurred;        /* to avoid loops on restart failure */
  209.     int    rb_checksum;        /* checksum of 1st 32 wrds of restrt */
  210.     char    *rb_fbss;        /* start of prom bss and stack area */
  211.     char    *rb_ebss;        /* end of prom bss and stack area */
  212.     /*
  213.      * These entries are for communication between the debug monitor
  214.      * and the client process being debugged
  215.      * NOTE: a return value of -1 from (*rb_vtop)() is distinguished
  216.      * to indicate that a translation could not be made.
  217.      */
  218.     int    (*rb_bpaddr)();        /* breakpoint handler */
  219.     int    (*rb_vtop)();        /* virtual to physical conversion rtn */
  220.     int    rb_flush;        /* flush cache since breakpoints were 
  221.                     set */
  222.     int    idbg_base;        /* start of idbg table */
  223.     int     brkpt_tbl;
  224.     int    nametab;        /* nametable address */
  225.     int    dbstab;            /* symbol table address */
  226.     int    linetab;        /* line number table address */
  227.     int    kidbg_func;        /* kernel idbg interface function */
  228.     int    ktlbfix;        /* kernel tlb fix */
  229. #if IP6 || IP12 || IP17
  230.     int    (*rb_printf)();        /* address of symmon's printf */
  231. #endif
  232. #if IP6 || IP12
  233.     int    rb_flags;        /* global flags for system */
  234.     struct promexec_args rb_peargs;
  235.     char    rb_pebuff[512];
  236. #endif
  237. #ifdef IP5
  238.     int    rb_filler[16];        /* so that bit mask isn't cksummed */
  239.     int    rb_cpumask;        /* bit mask of cpus present */
  240. #endif
  241.     /*
  242.      * config table goes here
  243.      */
  244. };
  245.  
  246. #if IP6 || IP12
  247. #define RB_GR1BAD    1    /* GR1 board failed diagnostics - don't use */
  248. #endif
  249.  
  250. #endif /* LANGUAGE_C */
  251.  
  252. #ifdef IP5
  253.  
  254. /* Prom entry points for IP[579], which have symmon, etc. in prom */
  255.  
  256. #define    IP5PROM_ENTRY(x)    (R_VEC+((x)*8))
  257.  
  258. #define    IP5PROM_RESET    IP5PROM_ENTRY(0)/* run diags, check bootmode, reinit */
  259. #define    IP5PROM_PRINTF    IP5PROM_ENTRY(1)/* regular printf */
  260. #define    IP5PROM_LPRINTF IP5PROM_ENTRY(2)/* loprintf, use 1st cache as stack */
  261. #define IP5PROM_SYMMON    IP5PROM_ENTRY(3)/* access to symmon */
  262. #define IP5PROM_REBOOT    IP5PROM_ENTRY(4)/* reload monitor  */
  263. #define IP5PROM_ATBOOT  IP5PROM_ENTRY(5)/* reload monitor, call autoboot */
  264. #define IP5PROM_BRKPT    IP5PROM_ENTRY(6)/* symmon's brkpt handler */
  265. #endif /* IP5 */
  266. #endif /* __SYS_ENTRYPT_H__ */
  267.